thanks
Post
Replies
Boosts
Views
Activity
Left blank
Yes. The ones I showed in the video were all initialized.
How I discovered the problem is that doing an IAP started resulting in no longer getting new lives (the code basically validates the receipt and then adds the (static let variable) to a numberOfLives var variable.
It seems that some variables get initialized properly and some don't? I can't think of what could cause this... and it makes no difference if it's done on the main thread or not.
Thank you for your help.
Sorry for the vagueness. Been answering on an iPhone and I'm not the best typer.
Claude31 - the Structs are just a way to keep things organized. It was an incomplete typo on my side...
The code should actually be written as
let newLives = purchasedApp ? Global.lives.paid : Global.lives.free
OOPer - The way I was checking (not shown I the video) is by running a (loadStaticVariableTest) function that has variables being assigned the values (ie var localLives = Global.lives.paid, etc... ) and setting a break point at the end of the function (I also checked by setting a break point on another line after calling the loadStaticVariableTest() function in a viewDidLoad event), then checking the values. Is there a way to check init and non-init lazy variables in debug?
UPDATE With additional troubleshooting, I see that this is only happening when running on a physical device, and NOT in the simulator.
I still need to find another device to test on. But... could there be a compiler setting or some type of timing issue that doesn't allow for some lazy variables to be initialized? (iPAD OS is 14.7.1 on iPad Pro 10.5 inch) (simulator is 14.5 on iPad 9.7)
Thanks OOPer.
I was going to upload the project for people to look at, but then got to borrow another iPad (iPad2). So now it looks like an isolated issue on the iPad I've been using (iPad1). It didn't happen on iPad2!
As clear as night and day! I reset iPad1 to factory defaults and tested. And now it works fine?!? Now I'm going to reload the backup I made before resetting.
Where are you placing your chunk(s). ie after the IHDR chunk and before the IDAT chunk(s), in front of other chunks, etc.?
Are you adding them just before saving the data to a file? How are you saving the data (ie pngData(), .writeTo(), etc...)
there could a number of reasons...
please post your code